<template>
  <div>
    <el-form :inline="true" :model="orderform" class="demo-form-inline">
      <el-form-item label="订单时间">
        <el-date-picker
          v-model="orderform.startTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择起始日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="服务项目">
        <el-input v-model="order.name" placeholder="请输入项目名称"></el-input>
      </el-form-item>
      <el-form-item label="服务金额">
        <el-input v-model="order.money" placeholder="请输入服务金额"></el-input>
      </el-form-item>
      <el-form-item label="用户名称">
        <el-input v-model="order.patientname" placeholder="请输入患者姓名"></el-input>
      </el-form-item>
      <el-form-item label="医生名称">
        <el-input v-model="order.doctorname" placeholder="请输入医生姓名"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>
    <el-button @click="neworder">下订单</el-button>
    <el-table :data="orderList">
      <el-table-column label="订单日期" prop="date" align="center"></el-table-column>
      <el-table-column label="服务项目名称" prop="operationname"align="center"></el-table-column>
      <el-table-column label="服务金额" prop="money"align="center"></el-table-column>
      <el-table-column label="患者名称" prop="patientname"align="center"></el-table-column>
      <el-table-column label="医生名称" prop="doctorname"align="center"></el-table-column>
      <el-table-column label="备注" prop="remark"align="center"></el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button @click="deleteStudent(scope.row.id)">删除</el-button>
          <el-button @click="update(scope.row)">修改</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      width="30%">
      <el-input type="hidden" v-model="order.doctorname"></el-input>
      患者名称：<el-input type="text" v-model="order.patientname" style="width: 300px"></el-input><br><br>
      服务名称：<el-input type="text" v-model="order.operationname" style="width: 300px"></el-input><br><br>
      服务金额：<el-input type="text" v-model="order.price"style="width: 300px"></el-input><br><br>
      备注：<el-input type="text" v-model="order.remark"style="width: 300px"></el-input><br><br>

      <div v-if="title=='充值'">\
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="addStudent">确 定</el-button>
      </div>
      <div v-else>
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="updateStudent">修 改</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "index",
    data() {
      return {
        title: '充值',
        dialogVisible: false,
        orderList: [],
        order: {
          doctorname:'',
          patientname: '',
          operationname: '',
          price:'',
          remark:''
        },
        orderform: {
          name: '',
          phone:'',
          status:'',
          startTime:'',
          endsTime:''
        },
      }
    },
    methods: {
      neworder: function () {
        this.title = "充值";
        this.dialogVisible = true;
      },
    }
  }
</script>

<style scoped>

</style>

